YARN-11326. [Federation] Add RM FederationStateStoreService Metrics.#4963
YARN-11326. [Federation] Add RM FederationStateStoreService Metrics.#4963goiri merged 37 commits intoapache:trunkfrom
Conversation
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
@goiri Can you help review this pr? I added Metric information for RM FederationStateStoreService. Thank you very much! |
| GetSubClusterPolicyConfigurationResponse response = | ||
| stateStoreClient.getPolicyConfiguration(request); | ||
| long stopTime = clock.getTime(); | ||
| FederationStateStoreServiceMetrics.succeededStateStoreServiceCall( |
There was a problem hiding this comment.
Thanks for your help reviewing the code, I will fix it.
| GetSubClusterPoliciesConfigurationsResponse response = | ||
| stateStoreClient.getPoliciesConfigurations(request); | ||
| long stopTime = clock.getTime(); | ||
| FederationStateStoreServiceMetrics.succeededStateStoreServiceCall( |
| AddApplicationHomeSubClusterResponse response = | ||
| stateStoreClient.addApplicationHomeSubCluster(request); | ||
| long stopTime = clock.getTime(); | ||
| FederationStateStoreServiceMetrics.succeededStateStoreServiceCall( |
| public DeleteApplicationHomeSubClusterResponse deleteApplicationHomeSubCluster( | ||
| DeleteApplicationHomeSubClusterRequest request) throws YarnException { | ||
| return stateStoreClient.deleteApplicationHomeSubCluster(request); | ||
| try { |
There was a problem hiding this comment.
We keep doing this over and over again.
There's no way to generalize this?
There was a problem hiding this comment.
Thanks for your suggestion, I will refactor this part of the code to use a generic method instead.
| @Test | ||
| public void testFederationStateStoreServiceMetricInit() { | ||
| LOG.info("Test: aggregate metrics are initialized correctly"); | ||
| assertEquals(0, |
| FederationStateStoreServiceMetrics.getNumSucceededCalls()); | ||
| double latencySucceessfulCalls = | ||
| FederationStateStoreServiceMetrics.getLatencySucceessfulCallsForMethod("registerSubCluster"); | ||
| Assert.assertEquals(100, latencySucceessfulCalls, 0); |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
|
@goiri Please help to review this pr again, thank you very much! |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
| return invoke(clientMethod, RouterMasterKeyResponse.class); | ||
| } | ||
|
|
||
| private <R> R invoke(FederationClientMethod request, Class<R> clazz) |
There was a problem hiding this comment.
Thanks for your help reviewing the code, I will add the java doc.
| return result; | ||
| } catch (Exception e) { | ||
| LOG.error("stateStoreClient call method {} error.", request.getMethodName(), e); | ||
| FederationStateStoreServiceMetrics.failedStateStoreServiceCall( |
| throws YarnException, IOException { | ||
| FederationClientMethod clientMethod = new FederationClientMethod( | ||
| "getMasterKeyByDelegationKey", RouterMasterKeyResponse.class, request); | ||
| return invoke(clientMethod, RouterMasterKeyResponse.class); |
There was a problem hiding this comment.
could we do something like:
clientMethod.invoke();
There was a problem hiding this comment.
Thank you for your suggestion, I will refactor this part of the code.
| } | ||
| FederationClientMethod clientMethod = new FederationClientMethod( | ||
| "getPoliciesConfigurations", GetSubClusterPoliciesConfigurationsResponse.class, request); | ||
| return invoke(clientMethod, GetSubClusterPoliciesConfigurationsResponse.class); |
There was a problem hiding this comment.
We have tests for all these metrics, right?
There was a problem hiding this comment.
I haven't finished the test yet, I will test the interface in junit Test.
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
| public GetSubClusterPolicyConfigurationResponse getPolicyConfiguration( | ||
| GetSubClusterPolicyConfigurationRequest request) throws YarnException { | ||
| return stateStoreClient.getPolicyConfiguration(request); | ||
| FederationClientMethod clientMethod = new FederationClientMethod( |
There was a problem hiding this comment.
Wouldn't it make more sense to make it:
FederationClientMethod<GetSubClusterPolicyConfigurationResponse>
?
There was a problem hiding this comment.
Or actually just specify it as an arg:
FederationClientMethod clientMethod = new FederationClientMethod(
"getPolicyConfiguration", GetSubClusterPolicyConfigurationRequest.class, request,
GetSubClusterPolicyConfigurationResponse.class,
stateStoreClient, clock);
There was a problem hiding this comment.
This is a good idea, I will modify the code.
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
@goiri Can you help review this PR again? Thank you very much! |
| throws YarnException, IOException { | ||
| return stateStoreClient.updateStoredToken(request); | ||
| FederationClientMethod<RouterRMTokenResponse> clientMethod = | ||
| new FederationClientMethod<>("updateStoredToken", |
There was a problem hiding this comment.
I don't know why the checkstyle is not flagging this, but the spacing doesn't look correctly.
@Override
public RouterRMTokenResponse updateStoredToken(RouterRMTokenRequest request)
throws YarnException, IOException {
FederationClientMethod<RouterRMTokenResponse> clientMethod = new FederationClientMethod<>(
"updateStoredToken",
RouterRMTokenRequest.class, request,
RouterRMTokenResponse.class, stateStoreClient, clock);
return clientMethod.invoke();
}
There was a problem hiding this comment.
Thanks for your suggestion! I will modify the code.
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
@goiri Thank you very much for helping to review the code! |
JIRA: YARN-11326. [Federation] Add RM FederationStateStoreService Metrics.